home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / WIN / VB_DB / PROFIT.ZIP / INGREDBT.BAS < prev    next >
Encoding:
BASIC Source File  |  1992-12-16  |  5.5 KB  |  164 lines

  1.    '****************************************************************
  2.    '*    Ingredient file type                                      *
  3.    '****************************************************************
  4.     
  5.     Type IngredientType
  6.         IngKey           As String * 15
  7.           'IngSupplierNo    AS STRING * 3
  8.           'IngNo            AS STRING * 12
  9.         IngGroup         As String * 4
  10.         IngDesc          As String * 30
  11.         IngSizeDesc      As String * 10
  12.         IngFormat        As String * 3
  13.         IngCaseCost      As Long
  14.         IngPacksPerCase  As Long
  15.         IngPackDesc      As String * 10
  16.         IngUnitsPerCase  As Long
  17.         IngUnitDesc      As String * 10
  18.     End Type
  19.    
  20.     Global IngredientRec As IngredientType
  21.     Global IngredientSaveRec As IngredientType
  22.     Global IngredientSt%
  23.     Global IngredientKeyB$
  24.     Global IngredientPosBlk As PosBlk
  25.  
  26. Sub CloseIngredientFile ()
  27.   '********** Close Ingredient file **********************
  28.     IngredientKeyBufLen% = 255
  29.     IngredientBufLen% = Len(IngredientRec)
  30.     KeyNum% = 0
  31.     IngredientSt% = 0
  32.     IngredientSt% = btrcall(BCLOSE, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  33. End Sub
  34.  
  35. Sub DeleteIngredient ()
  36.       IngredientKeyBufLen% = 255
  37.       IngredientBufLen% = Len(IngredientRec)
  38.       KeyNum% = 0
  39.       IngredientSt% = 0
  40.       IngredientSt% = btrcall(BDELETE, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  41. End Sub
  42.  
  43. Sub FirstIngredient ()
  44.   If Len(IngredientKeyB$) <> 15 Then
  45.     IngredientKeyB$ = String$(15, " ")
  46.   End If
  47.   IngredientKeyBufLen% = 255
  48.   IngredientBufLen% = Len(IngredientRec)
  49.   KeyNum% = 0
  50.   IngredientSt% = 0
  51.   IngredientSt% = btrcall(BFIRST, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  52. End Sub
  53.  
  54. Sub FirstIngredientKey1 ()
  55.   If Len(IngredientKeyB$) <> 19 Then
  56.     IngredientKeyB$ = String$(19, " ")
  57.   End If
  58.   IngredientKeyBufLen% = 255
  59.   IngredientBufLen% = Len(IngredientRec)
  60.   KeyNum% = 1
  61.   IngredientSt% = 0
  62.   IngredientSt% = btrcall(BFIRST, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  63. End Sub
  64.  
  65. Sub GetGEIngredient ()
  66.     IngredientKeyB$ = IngredientRec.IngKey
  67.     IngredientKeyBufLen% = 255
  68.     IngredientBufLen% = Len(IngredientRec)
  69.     KeyNum% = 0
  70.     IngredientSt% = 0
  71.     IngredientSt% = btrcall(BGETGE, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  72. End Sub
  73.  
  74. Sub MsgIngredientNotFound ()
  75.   Msg$ = "Ingredient not found.  Status = " + Str$(IngredientSt%)
  76.   T1% = MsgBox(Msg$, 0, "Warning!")
  77. End Sub
  78.  
  79. Sub MsgIngredientNotOpen ()
  80.         Msg$ = "Ingredient file not opened."
  81.         T1% = MsgBox(Msg$, 0, "Warning!")
  82. End Sub
  83.  
  84. Sub MsgUnknownIngredientError ()
  85.   Msg$ = "Ingredient file error.  Status = " + Str$(IngredientSt%)
  86.   T1% = MsgBox(Msg$, 0, "Warning!")
  87. End Sub
  88.  
  89. Sub NextIngredient ()
  90.   If Len(IngredientKeyB$) <> 15 Then
  91.     IngredientKeyB$ = String$(15, " ")
  92.   End If
  93.   IngredientKeyBufLen% = 255
  94.   IngredientBufLen% = Len(IngredientRec)
  95.   KeyNum% = 0
  96.   IngredientSt% = 0
  97.   IngredientSt% = btrcall(BNEXT, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  98. End Sub
  99.  
  100. Sub NextIngredientKey1 ()
  101.   If Len(IngredientKeyB$) <> 19 Then
  102.     IngredientKeyB$ = String$(19, " ")
  103.   End If
  104.   IngredientKeyBufLen% = 255
  105.   IngredientBufLen% = Len(IngredientRec)
  106.   KeyNum% = 1
  107.   IngredientSt% = 0
  108.   IngredientSt% = btrcall(BNEXT, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  109. End Sub
  110.  
  111. '
  112. '
  113. Sub OpenIngredientFile ()
  114.   
  115.   '******** Open Ingredient File ********************
  116.     IngredientKeyB$ = "ingdfile.btr"
  117.     IngredientKeyBufLen% = 255
  118.     IngredientBufLen% = Len(IngredientRec)
  119.     KeyNum% = 0
  120.     IngredientSt% = 0
  121.     IngredientSt% = btrcall(BOPEN, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  122.     If IngredientSt% <> 0 Then
  123.       Msg$ = "Ingredient file open failed. Status = " + Str$(IngredientSt%)
  124.       T1% = MsgBox(Msg$, 0, "Warning!")
  125.     End If
  126. End Sub
  127.  
  128. Sub PreviousIngredient ()
  129.   If Len(IngredientKeyB$) <> 15 Then
  130.     IngredientKeyB$ = String$(15, " ")
  131.   End If
  132.   IngredientKeyBufLen% = 255
  133.   IngredientBufLen% = Len(IngredientRec)
  134.   KeyNum% = 0
  135.   IngredientSt% = 0
  136.   IngredientSt% = btrcall(BPREVIOUS, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  137. End Sub
  138.  
  139. Sub ReadIngredient ()
  140.     IngredientKeyB$ = IngredientRec.IngKey
  141.     IngredientKeyBufLen% = 255
  142.     IngredientBufLen% = Len(IngredientRec)
  143.     KeyNum% = 0
  144.     IngredientSt% = 0
  145.     IngredientSt% = btrcall(BEQUAL, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  146. End Sub
  147.  
  148. Sub UpdateIngredient ()
  149.     IngredientKeyBufLen% = 255
  150.     IngredientBufLen% = Len(IngredientRec)
  151.     KeyNum% = 0
  152.     IngredientSt% = 0
  153.     IngredientSt% = btrcall(BUPDATE, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  154. End Sub
  155.  
  156. Sub WriteIngredient ()
  157.       IngredientKeyBufLen% = 255
  158.       IngredientBufLen% = Len(IngredientRec)
  159.       KeyNum% = 0
  160.       IngredientSt% = 0
  161.       IngredientSt% = btrcall(BINSERT, IngredientPosBlk, IngredientRec, IngredientBufLen%, IngredientKeyB$, IngredientKeyBufLen%, KeyNum%)
  162. End Sub
  163.  
  164.